package com.css.influence.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.css.influence.entity.Model;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Dbj
 * @date 2024年10月19日  17:18
 */
@Mapper
public interface ModelMapper extends BaseMapper<Model> {

    @Select("<script>" +
            "select \n" +
            "mo.*,shp.code \n" +
            "from baisc_model mo,basic_model_shp shp where mo.id = shp.model_id and \n" +
            " ST_Intersects(shp.geom,st_geometryfromtext(#{geomText},4490)) and shp.model_id =#{id} and mo.is_valid='1'" +
            "</script>"
    )
    List<Model> getIntersectsModel(@Param("geomText") String geomText, @Param("id") String modelId);

    @Select("select * from baisc_model where is_valid='1'")
    List<Model> list();
}
